package p.ithorns.tools.excel.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.List;
import java.util.Optional;

/**
 * 单页导入结果
 *
 * @author ithorns
 * @since 2024/7/31 14:36
 */

@Getter
@Setter
//@JsonIgnoreProperties({"type"})
public class ImportSheetResult<T> {

    // @ApiModelProperty("sheet页名称")
    private String sheetName;

    // @ApiModelProperty("成功数量")
    private int successCount;

    // @ApiModelProperty("失败数量")
    private int errorCount;

    // @ApiModelProperty("错误行信息")
    private List<RowError<T>> rowErrors;

    @JsonIgnore
    private final Class<T> type;

    public ImportSheetResult(Class<T> type) {
        this.type = Optional.ofNullable(type).orElse((Class<T>) Object.class);
    }

}